<?php
$cs = Yii::app()->getClientScript();
$cs->registerCSSFile(Yii::app()->request->baseUrl . '/css/main.css')
        ->registerCSSFile(Yii::app()->request->baseUrl . '/css/form.css')
        ->registerCSSFile(Yii::app()->request->baseUrl . '/css/themes/default/jquery.mobile-1.4.2.min.css')
        ->registerCSSFile(Yii::app()->request->baseUrl . '/css/jqm-datebox.min.css')
        ->registerCoreScript('jquery');
//$cs->registerCoreScript('jquery.ui');

$cs->registerCoreScript('jqm-setting')
        ->registerCoreScript('jquery.mobile');
$themePath = Yii::app()->request->baseUrl;
/**
 * StyleSheets
 */
if ($this->useBootstrap) {
    $cs->registerCssFile($themePath . '/assets/css/bootstrap.css');
    $cs->registerCssFile($themePath . '/assets/css/bootstrap-theme.css');
    $cs->registerCssFile($themePath . '/assets/css/jasny-bootstrap.min.css');
    $cs->registerScriptFile($themePath . '/assets/js/bootstrap.min.js', CClientScript::POS_END);
    $cs->registerScriptFile($themePath . '/assets/js/jasny-bootstrap.min.js', CClientScript::POS_END);
    $cs->registerScript('tooltip', "$('[data-toggle=\"tooltip\"]').tooltip();$('[data-toggle=\"popover\"]').tooltip()", CClientScript::POS_READY);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="language" content="en" />
        <meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1">

            <title><?php echo CHtml::encode($this->pageTitle); ?></title>
    </head>

    <body>

        <div data-role='page' id='mainPage'>
            <div data-role='header' data-position="fixed">
                <h1>
                    <?php
                    echo CHtml::encode($this->pageTitle);
                    ?>
                </h1>
                <?php
                if ($this->showBackButton) {
                    ?>
                    <a href="#" data-icon="back" data-rel="back"><?php echo Yii::t('site', 'Back'); ?></a>
                    <?php
                }
                ?>
            </div>

            <div data-role='content' id='mainContent' style='padding:0;'>
                <?php echo $content; ?>
            </div>

            <div data-role='footer' data-position="fixed">
                <?php if (!Yii::app()->user->isGuest) { ?>
                    <div data-role="navbar" data-iconpos="top">
                        <ul>
                            <li><?php echo CHtml::link(Yii::t('site', 'Recommend'), array('stadium/index'), array('data-icon' => 'home')); ?></li>
                            <li><?php echo CHtml::link(Yii::t('site', 'Search'), array('stadium/search'), array('data-icon' => 'search')); ?></li>
                            <li><?php echo CHtml::link(Yii::t('site', 'Bookmark'), array('stadium/favorites'), array('data-icon' => 'star')); ?></li>
                            <li><?php echo CHtml::link(Yii::t('site', 'History'), array('stadium/history'), array('data-icon' => 'star')); ?></li>
                            <?php
                            if (!Yii::app()->user->isGuest) {
                                ?>
                                <li><a href="#settingMenu" data-rel="popup" data-icon="gear"><?php echo Yii::t('site', 'Setting'); ?></a></li>
                            <?php } ?>
                        </ul>
                    </div>
                    <div data-role="popup" id="settingMenu">
                        <ul data-role="listview" data-inset="true" style="min-width:210px;">
                            <li data-role="divider"><?php echo Yii::t('site', 'User Info'); ?></li>
                            <li><?php echo CHtml::link(Yii::t('site', 'Logout'), array('site/logout')); ?></li>
                        </ul>
                    </div>
                <?php } ?>
            </div>
        </div>

        <?php
        if (isset($this->dialog) && $this->dialog != NULL) {
            $this->renderPartial($this->dialog, $this->dialogInfo);
        }
        ?>

    </body>
</html>

<script>
    $('#mainPage').on('pageshow', function() {
        $(":checkbox").hide(); //fix render issue by caix
    });
</script>
